﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using EzDeploy.Core;

namespace EzDeploy
{
    public partial class DuplicateAssemblyNameForm : Form
    {
        public DuplicateAssemblyNameForm(Dictionary<string, List<DeployGridItem>> source)
        {
            InitializeComponent();

            foreach (var pair in source)
            {
                var gr = new ListViewGroup(pair.Key);
                lvItems.Groups.Add(gr);

                foreach (var item in pair.Value)
                {
                    var lstItem = new ListViewItem(new string[] { item.AssemblyName.Name, item.ItemVersion, item.AssemblyName.Runtime.ToString(), item.ItemFullPath });
                    lstItem.Group = gr;

                    lvItems.Items.Add(lstItem);
                }
            }
        }

        private void ManualFix(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }

        private void ExcludeAll(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
        }
    }
}
